<div class="row">
    	<div class="col-xs-12">
      		<div class="wx-cover-item noborder text-center">
	       		{{$this->Html->image($WxActivity['WxActivity']['coverimg'])}}
				<h2>{{$WxActivity['WxActivity']['name']}}</h2>
			</div>
			
			<p>{{nl2br($WxActivity['WxActivity']['summary'])}}</p>
			
       		<div style="border:2px dashed #CCC;padding:5px;margin:20px 0;">
				<p><strong>活动信息：</strong></p>
				<p>开始时间： {{substr($WxActivity['WxActivity']['started'],0,16)}}</p>
				<p>结束时间： {{substr($WxActivity['WxActivity']['ended'],0,16)}}</p>
			</div>
<style>
.vote-item {height:270px;text-align:center;min-width:140px;}
.vote-item img{max-height:160px;}
.vote-item-img {height:160px;display:table-cell;vertical-align: middle;text-align:center; width: 250px;max-width: 100%;}
.vote-item h4{height:32px;}
   
</style>			
<ul class="nav nav-tabs">
  <li role="presentation" {{if empty($_REQUEST['sort']) || $_REQUEST['sort']=='sequence'}}class="active"{{/if}}><a href="?sort=sequence">按序号</a></li>
  <li role="presentation" {{if $_REQUEST['sort']=='hot'}}class="active"{{/if}}><a href="?sort=hot">按热度</a></li>
</ul>
<div style="margin-top:10px;">		
			<div class="row">
			{{loop $votes  $vote}}
				<div class="col-xs-6">
					<div class="vote-item">
						<a href="{{Router::url('/wx_votes/view/'.$vote['WxVote']['id'])}}">
							<div class="vote-item-img">
							{{if $vote['WxVote']['coverimg']}}
								<img src="{{Router::url($vote['WxVote']['coverimg'])}}">
							{{/if}}
							</div>
							<h4>
								{{if $vote['WxVote']['voice_file']}}
									<i class="fa fa-music"></i> 
								{{elseif $vote['WxVote']['video_file']}}
									<i class="fa fa-film"></i> 
								{{/if}} 

								{{$vote['WxVote']['name']}}  ({{$vote['WxVote']['vote_nums']}}票)</h4>
						</a>
						<!--  vote-btn --><a  href="{{Router::url('/wx_votes/view/'.$vote['WxVote']['id'])}}" data-sequence="{{$vote['WxVote']['sequence']}}" class="btn btn-sm btn-primary">投一票</a>
					</div>
				</div>
			{{/loop}}
			</div>
			
			<div class="wx-text-item noborder">{{$WxActivity['WxActivity']['content']}}</div>
			<br/>
			<p>查看次数: {{$WxActivity['WxActivity']['view_nums']}}</p>
		</div>
</div>
</div>	

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">关注投票</h4>
      </div>
      <div class="modal-body">
      	<div style="border:2px dashed #CCC;padding:5px;margin:20px 0;">
				<p><strong>投票方法：</strong></p>
				<p>关注公众号“<a href="javascript:void(0)">{{$current_wxinfo['Wx']['name']}}</a>”</p>
				<p>回复“<strong id="vote-code">tp{{$WxVote['WxVote']['sequence']}}</strong>”参与投票</p>
		</div>
			
         {{if ($current_wxinfo['Wx']['qrcode'])}}
         <p class="text-center">
         <img src="{{$current_wxinfo['Wx']['qrcode']}}"><br/>
         长按二维码关注
         </p>
         {{/if}}
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
	
<script>
$(function(){	
	$('.vote-btn').click(function(){
		$('#myModal').modal();
		$('#vote-code').html( 'tp'+$(this).data('sequence') );
		return false;
	})
})
</script>